package com.ssd.controller;

import com.ssd.entity.Job;
import com.ssd.service.JobService;
import com.ssd.view.BaseResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * JobController 类
 *
 * @title:
 * @requirement:
 * @ClassName:
 * @author:首雯静
 * @creationTime:2024/12/20/10:34
 * @version: 1.0
 */
@RestController
@RequestMapping("/manage/job")
public class JobController {

    @Autowired
    private JobService jobService;

    /**
     * 查询补货配置
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public BaseResponse<Job> getById(@PathVariable Integer id){
        Job job = jobService.getById(id);
        return new BaseResponse<Job>(job);
    }

    /**
     * 修改补货配置
     * @param job
     * @return
     */
    @PutMapping
    public BaseResponse edit(@RequestBody Job job){
        boolean updated = jobService.updateJob(job);
        return new BaseResponse(updated);
    }
}